
// 179.最大数
class Solution {
public:
    string largestNumber(vector<int>& nums) {
        // 对数组进行排序

        function<bool(int , int)> comp = [&](int x, int y)
        {
            string str1 = to_string(x) , str2 = to_string(y);
            return str1 + str2 > str2 + str1;
        };

        sort(nums.begin() , nums.end() , comp);
        string ret;
        for(auto & x : nums) ret += to_string(x);
        if(ret[0] == '0') return "0";
        return ret;
    }
};